{% extends 'base.twig' %}

{% block content %}
<section id="main-content">
    <section class="wrapper">
        <div class="row mt">
            <div class="col-lg-12">
                <div class="form-panel">
                    <h4 class="mb text-info">
                        {% if  product_id %}
                            <i class="fa fa-edit"></i> 修改用户 -- {{ username }}
                        {% else %}
                            <i class="fa fa-plus"></i> 新增用户
                        {% endif %}
                        <button class="text-right btn btn-success pull-right"  {% if readonly is null %} onclick="$('#form').submit();" {% endif  %} ><i class="fa fa-save"></i> 保 存 </button>
                    </h4>
                    {% if error %}
        
                        {% for e in error %}
                            <p class="text-danger bg-warning text-center" style="padding: 5px 0"> ** {{ e.title }} **</p>
                        {% endfor %}
    
                    {% endif %}
    
                    <form id='form' name="form" class="form-horizontal style-form" method="post" action="user.php?&act=save" >
                        <input type="hidden" name="uid" value="{{ uid }}">
                        <div  class="form-group">
                            <label class="col-sm-2 col-sm-2 text-center" > 用户组 </label>
                            <div class="col-sm-10">
                                <select class="form-control" required name="user_group_id">
                                    <option value=""> 选择用户组 </option>
                                      {% for u in user_group %}
                                       <option value="{{ u.user_group_id }} " {% if u.user_group_id == user_group_id %} selected {% endif %}> {{ u.title }}</option>
                                      {% endfor %}
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 col-sm-2 text-center" > 用户名 </label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="username" value="{{ username }}" required>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 col-sm-2 text-center" > 邮箱 </label>
                            <div class="col-sm-10">
                                <input type="email" class="form-control" name="email" value="{{ email }}" required>
                            </div>
                        </div>
    
                        <div class="form-group">
                            <label class="col-sm-2 col-sm-2 text-center" > 密码 </label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="password" value=""> <br/>
                                 <span class="text-danger"> ** 不修改密码。此项为空。</span>
                            </div>
                        </div>
                    </form>
                </div>
                
            </div>
        </div>
    </section>
</section>
    <script type="text/javascript">
        highlight_subnav('user.php?');
    </script>
{% endblock %}